package labox.innovation.gameserver.network.clientpackets;

import labox.innovation.gameserver.network.serverpackets.CharSelectionInfo;

/**
 * 客户端请求恢复角色
 *
 * @version $Revision: 1.4.2.1.2.2 $ $Date: 2005/03/27 15:29:29 $
 */
public final class CharacterRestore extends L2GameClientPacket {
	
	private static final String _C__16_CHARACTERRESTORE = "[C] 16 CharacterRestore";
	
	private int _charSlot;

	@Override
	protected void readImpl() {
		_charSlot = readByte();
	}

	@Override
	protected void runImpl() {
		try {
			getClient().markRestoredChar(_charSlot);
		} catch (Exception e) {
		}
		CharSelectionInfo cl = new CharSelectionInfo(getClient().getAccountName(), getClient().getSessionId(), 0);
		sendPacket(cl);
		getClient().setCharSelection(cl.getCharInfo());
	}

	/* (non-Javadoc)
	 * @see labox.innovation.gameserver.clientpackets.ClientBasePacket#getType()
	 */
	@Override
	public String getType() {
		return _C__16_CHARACTERRESTORE;
	}
}
